<style>
#debt_report form.area{
	width:800px;
}
#debt_report form.area select{
	width:170px;
}
#debt_report h1.report{
	padding-left:24px;
}
#debt_report{
	width:850px;
}
#debt_report fieldset{
	float:left;
}
#debt_report .cell{
	float:left;
	margin:0px 5px;
}
#debt_report .area_white{
	margin:2px 2px 0px 0px;
}
#debt_report #debt_report_result table{
	width:400px;
	clear:both;
}
#debt_report #debt_report_result table tr.sum{
	font-weight:bolder;
}
#debt_report #radnik_details table{
	clear:both;
	width:400px;
}
#debt_report #radnik_details tr{
	display:none;
}
#debt_report #radnik_details tr.overflow{
	background-color:#f00;
	color:#fff;
}
#debt_report #radnik_details tr.cash{
	background-color:#fff000;
}
#debt_report #radnik_details tr.head td{
	text-align:center;
}
#debt_report #radnik_details tr td.align_right{
	text-align:right;
}
#debt_report tr.CurrentRadnikRow td{
	background:{{$highlight}};
	color:{{$highlighttext}};
}
#debt_report #sbmt{
	float:right;
}
</style>
<div id="debt_report">
	<form method="post" action="javascript:void(0)" onsubmit="submitForm(this,'ugovori.php','POST','setContent',1)" class="area">

		<h1 class="report">Naplaćeni / Zaključeni ugovori</h1>
	
		<input type="hidden" name="a" value="real_report" />
		<input type="hidden" name="mod" value="debt" />
		
		<fieldset>
			<legend>Datum uplate:</legend>
			
			<label for="filter_date_uplate_od" class="left">od:</label>
			<input type="text" class="dateInput" name="filter_date_uplate_od" id="filter_date_uplate_od" value="{{$filter_date_uplate_od}}" />
			<input type="button" class="datePicker" onclick="displayDatePicker('filter_date_uplate_od',this)" />
			
			<label for="filter_date_uplate_do" class="left">do:</label>
			<input type="text" class="dateInput" name="filter_date_uplate_do" id="filter_date_uplate_do" value="{{$filter_date_uplate_do}}" />
			<input type="button" class="datePicker" onclick="displayDatePicker('filter_date_uplate_do',this)" />
		</fieldset>
		
		<fieldset>
			<legend>Datum ugovora:</legend>
			
			<label for="filter_date_ugovor_od" class="left">od:</label>
			<input type="text" class="dateInput" name="filter_date_ugovor_od" id="filter_date_ugovor_od" value="{{$filter_date_ugovor_od}}" />
			<input type="button" class="datePicker" onclick="displayDatePicker('filter_date_ugovor_od',this)" />
			
			<label for="filter_date_ugovor_do" class="left">do:</label>
			<input type="text" class="dateInput" name="filter_date_ugovor_do" id="filter_date_ugovor_do" value="{{$filter_date_ugovor_do}}" />
			<input type="button" class="datePicker" onclick="displayDatePicker('filter_date_ugovor_do',this)" />
		</fieldset>

		<div class="cell">
			<div style="float:right">
				<input type="submit" value="Kreiraj" id="sbmt" /><br clear="all" />
				<div class="info" style="float:right;">{{$info}}</div>
			</div>
			<div style="float:left">
				<label for="filter_active" class="left">Samo aktivni radnici:</label>
				<input type="checkbox" name="filter_active" id="filter_active" {{$checked_filter_active}} />
				
				<br clear="all" />
				<label for="filter_storno" class="left">Bez storno ugovora:</label>
				<input type="checkbox" name="filter_storno" id="filter_storno" {{$checked_filter_storno}} />
			</div>
			
		</div>
		<br clear="all" />
		
		
		<label for="filter_kampanja" class="left">Kampanja:</label>
		<select name="filter_kampanja" id="filter_kampanja">
			<option value="-1">---</option>
			{{%loop start kampanja_id}}
			<option value="{{$kampanja_id}}" {{$selected_filter_kampanja}}>{{$kampanja_name}}</option>
			{{%loop end}}
		</select>
		<label class="left" for="filter_radnik">Komercijalista:</label>
		<select name="filter_radnik" id="filter_radnik">
			<option value="-1">---</option>
			{{%loop start filter_radnik_id}}
			<option value="{{$filter_radnik_id}}" {{$radnik_selected_filter}}>{{$filter_radnik_ime}}&nbsp;{{$filter_radnik_prezime}}</option>
			{{%loop end}}
		</select>
		
		<label class="left" for="filter_delatnost">Delatnost:</label>
		<select name="filter_delatnost" id="filter_delatnost">
			<option value="-1">---</option>
			{{%loop start filter_delatnost_id}}
			<option value="{{$filter_delatnost_id}}" {{$filter_delatnost_selected}}>{{$filter_delatnost_name}}</option>
			{{%loop end}}
		</select>
		
	</form><br clear="all" />
	
	{{$comment_start}}
	<div class="area_white" id="debt_report_result">
		<input type="button" class="excel" onclick="exportCSV(this.nextSibling.nextSibling)" value="preuzmi" />
		<table>
			<tr class="head" align="center">
				<td>istek ugovora</td>
				<td>radnik</td>
				<td>broj ugovora</td>
				<td>zaključeno</td>
				<td>naplaćeno</td>
			</tr>
			{{%loop start radnik_id}}
			<tr title="Detalji..." onclick="UgovoriZakjNapRepRadDetails('{{$radnik_id}}',this);">
				<td>{{$radnik_ugovor_end}}</td>
				<td>{{$radnik}}</td>
				<td align="center">{{$num_ugovora}}</td>
				<td align="right">{{$zakljuceno}}</td>
				<td align="right">{{$naplaceno}}</td>
			</tr>
			{{%loop end}}
			<tr class="sum">
				<td colspan="2" align="right">UKUPNO:</td>
				<td align="center">{{$sum_ugo}}</td>
				<td align="right">{{$sum_zaklj}}</td>
				<td align="right">{{$sum_napla}}</td>
			</tr>
		</table>
	</div>
	<div class="area_white" id="radnik_details">
		<input type="button" class="excel" value="preuzmi" onclick="CopyFilteredUgovors(this.nextSibling.nextSibling)" />
		<table>
			<tr class="head">
				<td rowspan="2">ugovor</td>
				<td colspan="2">komitent</td>
				<td rowspan="2">zaključeno</td>
				<td rowspan="2">naplaćeno</td>
			</tr>
			<tr class="head">
				<td>šifra</td>
				<td>ime</td>
			</tr>
			{{%loop start details_radnik}}
			<tr radnik="{{$details_radnik}}" class="{{$class_overflow}} {{$class_cash}}">
				<td><a href="javascript:void(0)" onclick="blankTarget('LoadRSDoc(\'ugovori.php?a=display&id={{$details_ugovor_id}}\',\'setContent\')')">{{$details_ugovor}}</a></td>
				<td><a href="javascript:void(0)" onclick="blankTarget('LoadRSDoc(\'komitenti.php?a=displayOne&id={{$details_komid}}\',\'setContent\')')">{{$details_komid}}</a></td>
				<td><a href="javascript:void(0)" onclick="blankTarget('LoadRSDoc(\'komitenti.php?a=displayOne&id={{$details_komid}}\',\'setContent\')')">{{$details_komname}}</a></td>
				<td class="align_right" title="{{$details_ugovor_date}}">{{$details_zakljuceno}}</td>
				<td class="align_right" title="{{$details_otplata_date}}">{{$details_naplaceno}}</td>
			</tr>
			{{%loop end}}
		</table>
	</div>
	{{$comment_end}}
</div>